<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2017/8/16
 * Time: 0:26
 */

namespace app\admin\controller\staff;

use app\common\controller\Backend;
class Testsql extends Backend
{
	protected $model = null;
	
	public function _initialize()
	{
		parent::_initialize();
		$this->model = model('Staff');
	}
	
	/**
	 * 查看
	 */
	public function index()
	{
		list($where, $sort, $order, $offset, $limit) = $this->buildparams(NULL);
		$total = $this->model
			->where($where)
			->order($sort, $order)
			->count();
		$list = $this->model->with('Grade')
			->where($where)
			->order($sort, $order)
			->limit($offset, $limit)
			->select();
		$result = array("total" => $total, "rows" => $list);
		
		return json($result);
	}
}
